﻿namespace System.Workflow.ComponentModel.Compiler
{
    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Xml;
    using System.Xml.Serialization;

    internal sealed class AuthorizedTypesSectionHandler : IConfigurationSectionHandler
    {
        object IConfigurationSectionHandler.Create(object parent, object configContext, XmlNode section)
        {
            List<AuthorizedType> list = new List<AuthorizedType>();
            XmlSerializer serializer = null;
            serializer = new XmlSerializer(typeof(AuthorizedType));
            foreach (XmlNode node in section.ChildNodes)
            {
                AuthorizedType item = serializer.Deserialize(new XmlNodeReader(node)) as AuthorizedType;
                if (item != null)
                {
                    list.Add(item);
                }
            }
            return list;
        }
    }
}

